package T;

import java.util.Arrays;
/**
sort倒叙，lambda表达式的使用
 以及正倒叙的排序方法
 */
public class Test2 implements Eat{
    public static void main(String[] args) {
        Integer[] x = {-1,2,1,4,6,3,5};

        Arrays.sort(x);
        System.out.println("正叙"+Arrays.toString(x));
        Arrays.sort(x, (a, b) -> b - a);
        System.out.println("倒叙"+Arrays.toString(x));

        Eat e = s -> System.out.println(s);
        e.eat("lambda表达式1");

        Eat e2 = System.out::println;
        e2.eat("lambda表达式2");

        Cat c = (a,b) -> System.out.println(a + " " +b);
        c.cat("lambda表达式a","lambda表达式b");


        Test2 test2 = new Test2();
        test2.eat("implements T.Eat");

    }


    @Override
    public void eat(String s) {
        System.out.println(s);
    }
}

interface Eat {
    void eat(String s);
}

interface Cat {
    void cat(String a,String b);
}